Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TakV2Compressor.kt renovate/net.java.dev.jna-jna-5.x (5a8f4966) Text, 2.33 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.takserver

Tff7b72import T7ee787org.meshtastic.proto.TAKPacketV2

T8b949e/**
* TAKPacket V2 wire format compressor/decompressor.
*
* Wire format: [1 byte flags][zstd-compressed TAKPacketV2 protobuf] Flags byte bits 0-5 = dictionary ID, bits 6-7 =
* reserved. Special value 0xFF = uncompressed raw protobuf (from TAK_TRACKER firmware).
*
* Platform-specific implementations use zstd with pre-trained dictionaries.
*/
Tff7b72internal Tff7b72expect Tff7b72object T56d364TakV2Compressor Tb4b4b4{

T8b949e/** Maximum allowed decompressed payload size (bytes). */
Tff7b72val Te6edf3MAX_DECOMPRESSED_SIZETb4b4b4: Tffa657Int

T8b949e/** Dictionary ID for non-aircraft types. */
Tff7b72val Te6edf3DICT_ID_NON_AIRCRAFTTb4b4b4: Tffa657Int

T8b949e/** Dictionary ID for aircraft types. */
Tff7b72val Te6edf3DICT_ID_AIRCRAFTTb4b4b4: Tffa657Int

T8b949e/** Special flags byte value indicating uncompressed raw protobuf. */
Tff7b72val Te6edf3DICT_ID_UNCOMPRESSEDTb4b4b4: Tffa657Int

T8b949e/**
* Compress a TAKPacketV2 into wire payload: [flags byte][zstd compressed protobuf]. Selects dictionary based on the
* CoT type classification.
*/
Tff7b72fun Td2a8ffcompressTb4b4b4(Te6edf3packetTb4b4b4: Te6edf3TAKPacketV2Tb4b4b4)Tb4b4b4: Te6edf3ByteArray

T8b949e/**
* Decompress a wire payload back to TAKPacketV2. Handles both compressed (dict-based) and uncompressed (0xFF)
* payloads.
*
* @throws IllegalArgumentException if payload is malformed or exceeds size limits.
*/
Tff7b72fun Td2a8ffdecompressTb4b4b4(Te6edf3wirePayloadTb4b4b4: Te6edf3ByteArrayTb4b4b4)Tb4b4b4: Te6edf3TAKPacketV2

T8b949e/**
* Decompress a wire payload and reconstruct CoT XML via the SDK's CotXmlBuilder. Handles ALL payload types
* (DrawnShape, Marker, Route, etc.) without going through the Wire proto intermediate.
*/
Tff7b72fun Td2a8ffdecompressToXmlTb4b4b4(Te6edf3wirePayloadTb4b4b4: Te6edf3ByteArrayTb4b4b4)Tb4b4b4: Tffa657String
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s